package com.emep.changzhi.analyse.http.Technology;


import com.emep.changzhi.analyse.entity.Technology.LimeRockWetDenitrification;
import com.emep.changzhi.analyse.entity.Technology.SNCRDenitrification;
import com.emep.changzhi.analyse.model.ResultBean;
import com.emep.changzhi.analyse.service.Technology.LimeRockWetDenitrificationService;
import com.emep.changzhi.analyse.utils.Constant;
import com.emep.changzhi.analyse.utils.DataValidator;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("limeRockWet")
@Api(value="石灰石(石灰)湿法脱硫",tags={"石灰石(石灰)湿法脱硫操作接口"})
public class LimeRockWetDenitrificationController {

    @Autowired
    private LimeRockWetDenitrificationService service;

    @ApiOperation(value="添加", notes="添加")
    @ApiResponses({ @ApiResponse(code = 1, message = "操作成功"),
            @ApiResponse(code = 0, message = "操作失败，服务器内部异常"),
            @ApiResponse(code = 303, message = "权限不足") })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entrance_smoke", value = "入口烟气量", required = true, dataType = "Double",paramType="query")
    })
    @PostMapping(value = "add")
    public ResultBean<LimeRockWetDenitrification> add(@RequestParam Map<String, Object> payload){
        ResultBean result = DataValidator.validateMapData(payload,"entranceSmoke");
        if (result.getCode() == Constant.RESULT_CODE_SUCCESS){

            return result.boolAdd(service.add(payload)) ;
        }
        return  result;

    }



    @ApiOperation(value="查询", notes="查询")
    @ApiResponses({ @ApiResponse(code = 1, message = "操作成功"),
            @ApiResponse(code = 0, message = "操作失败，服务器内部异常"),
            @ApiResponse(code = 303, message = "权限不足") })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "begin", value = "起始时间", required = true, dataType = "String",paramType="query"),
            @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "String",paramType="query")
    })
    @GetMapping(value = "list")
    public ResultBean<LimeRockWetDenitrification> list(@RequestParam String page, @RequestParam String rows, @RequestParam Map<String, Object> payload){
        ResultBean result = DataValidator.validateMapData(payload,"begin","end");
        if (result.getCode() == Constant.RESULT_CODE_SUCCESS){
            return result.boolAdd(service.list(Integer.valueOf(page),Integer.valueOf(rows),payload)) ;
        }
        return  result;

    }


}
